global gCDDrive, gCurriculum, gMacMenu, gCDVolume, acro
set the exitLock to 1
set gCDDrive to EMPTY
set gCurriculum to "TANS"
set gCDVolume to "The American Nation:"
if the platform contains "macintosh" then
set gMacMenu to "off"
else
set gMacMenu to "nomenu"
end if
macMenuOn()
if the platform contains "macintosh" then
set acro to initMasterApp("5rhchurw2pt6")
end if
end
on stopMovie
global acro
if the platform contains "macintosh" then
cleanUp(acro)
end if
end
on DirectorTask
global acro
return DirectorTask(acro)
end
on GetTaskOrder
global acro
return GetTaskOrder(acro)
end
on FeedGenericTimeSlice
global acro
FeedGenericTimeSlice(acro)
end
on macMenuOn
global gMacMenu
if gMacMenu = "off" then
installMenu(member "Menubar")
set gMacMenu to "on"
end if
end
on macMenuOFF
global gMacMenu
if gMacMenu = "on" then
installMenu(0)
set gMacMenu to "off"
end if
end
on checkMacMenuStatus
global gMacMenu
if gMacMenu = "off" then
macMenuOn()
end if
end
on macMenuQuit
macMenuOFF()
go("exit")
end
on openPDF fileName, mode
global gCDDrive, gCDVolume
if the platform contains "windows" then
case mode of
"CD":
if gCDDrive = EMPTY then
set myfile to new(xtra("fileio"))
repeat with i = 66 to 90
set drive to numToChar(i)
set thisPath to string(drive & ":\" & fileName)
openFile(myfile, thisPath, 1)
if status(myfile) = 0 then
set gCDDrive to drive
exit repeat
end if
end repeat
set myfile to 0
end if
set PDFname to gCDDrive & ":\" & fileName
"HD":
set tempdir to the pathName
repeat while the last char in tempdir <> "\"
delete char -30000 of tempdir
end repeat
set PDFname to tempdir & fileName
"AB":
set PDFname to fileName
end case
set iError to openFile(xtra("QILingo"), PDFname)
if iError <= 32 then
case iError of
0, 8:
return "Could not open the file, because there is not enough free memory. Close other open applications and try again."
2, 3:
if mode = "CD" then
return "Could not open the file, because it was not found. Make sure the Resource Pro CD-ROM is in your CD-ROM drive and try again."
else
return "Could not open the file, because it was not found. Make sure all components of Resource Pro have been installed correctly."
end if
31:
return "Acrobat Reader is required to view this document. The Acrobat Reader installer is located on the Resource Pro CD-ROM. Please install Acrobat Reader, then try again."
otherwise:
return "Could not open the file because an error occurred: " & iError
end case
else
return "none"
end if
else
case mode of
"CD":
set PDFname to gCDVolume & fileName
"HD":
set tempdir to the pathName
repeat while the last char in tempdir <> ":"
delete char -30000 of tempdir
end repeat
set PDFname to tempdir & fileName
"AB":
set PDFname to fileName
end case
set iError to launchAcroWithDoc(PDFname)
if iError < 0 then
case iError of
(-1):
if mode = "CD" then
return "Could not open the file, because it was not found. Make sure the Resource Pro CD-ROM is in your CD-ROM drive and try again."
else
return "Could not open the file, because it was not found. Make sure all components of Resource Pro have been installed correctly."
end if
(-35):
return "Acrobat Reader is required to view this document. The Acrobat Reader installer is located on the Resource Pro CD-ROM. Please install Acrobat Reader, then try again."
(-108):
return "Could not open the file, because there is not enough free memory. Close other open applications and try again."
otherwise:
return "Could not open the file because an error occurred: " & iError
end case
else
return "none"
end if
end if
end
on OpenApp fileName, mode, cmdLine
global gCDDrive, gCDVolume
if the platform contains "windows" then
case mode of
"CD":
if gCDDrive = EMPTY then
set myfile to new(xtra("fileio"))
repeat with i = 66 to 90
set drive to numToChar(i)
set thisPath to string(drive & ":\" & fileName)
openFile(myfile, thisPath, 1)
if status(myfile) = 0 then
set gCDDrive to drive
exit repeat
end if
end repeat
set myfile to 0
end if
set appname to gCDDrive & ":\" & fileName
set appdir to gCDDrive & ":\"
"HD":
set tempdir to the pathName
repeat while the last char in tempdir <> "\"
delete char -30000 of tempdir
end repeat
set appname to tempdir & fileName
set appdir to tempdir
"AB":
set appname to fileName
set appdir to appname
repeat while the last char in appdir <> "\"
delete char -30000 of appdir
end repeat
end case
if cmdLine <> VOID then
set iError to ShellExecute(xtra("QILingo"), "open", appname, cmdLine, appdir, 1)
else
set iError to openFile(xtra("QILingo"), appname)
end if
if iError <= 32 then
case iError of
0, 8:
return "Could not open the application, because there is not enough free memory. Close other open applications and try again."
2, 3:
if mode = "CD" then
return "Could not open the application, because it was not found. Make sure the Resource Pro CD-ROM is in your CD-ROM drive and try again."
else
return "Could not open the application, because it was not found. Make sure all components of Resource Pro have been installed correctly."
end if
otherwise:
return "Could not open the application because an error occurred: " & iError
end case
else
return "none"
end if
else
case mode of
"CD":
set appname to gCDVolume & fileName
"HD":
set tempdir to the pathName
repeat while the last char in tempdir <> ":"
delete char -30000 of tempdir
end repeat
set appname to tempdir & fileName
"AB":
set appname to fileName
end case
if cmdLine <> VOID then
set iError to launchApp(appname, cmdLine)
else
set iError to launchApp(appname)
end if
if iError < 0 then
case iError of
(-1):
if mode = "CD" then
return "Could not open the application, because it was not found. Make sure the Resource Pro CD-ROM is in your CD-ROM drive and try again."
else
return "Could not open the application, because it was not found. Make sure all components of Resource Pro have been installed correctly."
end if
(-108):
return "Could not open the application, because there is not enough free memory. Close other open applications and try again."
otherwise:
return "Could not open the application because an error occurred: " & iError
end case
else
return "none"
end if
end if
end
on OpenDIR fileName, mode
global gCDVolume
set dirName to EMPTY
if the platform contains "windows" then
case mode of
"CD":
set myfile to new(xtra("fileio"))
repeat with i = 66 to 90
set drive to numToChar(i)
set thisPath to string(drive & ":\" & fileName)
openFile(myfile, thisPath, 1)
if status(myfile) = 0 then
set dirName to drive & ":\" & fileName
closeFile(myfile)
exit repeat
end if
end repeat
set myfile to 0
"HD":
set tempdir to the pathName
repeat while the last char in tempdir <> "\"
delete char -30000 of tempdir
end repeat
set dirName to tempdir & fileName
"AB":
set dirName to fileName
end case
if dirName = EMPTY then
if mode = "CD" then
return "Could not open the file, because it was not found. Make sure the Resource Pro CD-ROM is in your CD-ROM drive and try again."
else
return "Could not open the file, because it was not found. Make sure all components of Resource Pro have been installed correctly."
end if
end if
go(1, dirName)
return "none"
else
set err to "none"
case mode of
"CD":
set dirName to gCDVolume & fileName
set myfile to new(xtra("fileio"))
openFile(myfile, dirName, 1)
if status(myfile) <> 0 then
set err to "no cd"
closeFile(myfile)
end if
set myfile to 0
"HD":
set tempdir to the pathName
repeat while the last char in tempdir <> ":"
delete char -30000 of tempdir
end repeat
set dirName to tempdir & fileName
"AB":
set dirName to fileName
end case
if err <> "none" then
if mode = "CD" then
return "Could not open the file, because it was not found. Make sure the Resource Pro CD-ROM is in your CD-ROM drive and try again."
else
return "Could not open the file, because it was not found. Make sure all components of Resource Pro have been installed correctly."